'use strict'

const BaseController  = require('./base');

class TopicController extends BaseController {
    // 获取话题列表
    async topicList(){
        const data = await this.ctx.service.topic.topicList(this.ctx.request.body)
        this.success(data)
    }

    // 创建话题
    async createTopic(){
        await this.ctx.service.topic.createTopic(this.ctx.request.body)
        this.success(null,"创建话题成功！")
    }

    // 删除话题
    async deleteTopic(){
        await this.ctx.service.topic.deleteTopic(this.ctx.request.body.ids)
        this.success()
    }

    // 修改话题
    async updateTopic(){
        await this.ctx.service.topic.updateTopic(this.ctx.request.body)
        this.success()
    }
}

module.exports = TopicController;